package myThread;

class Singleton{
    private static Singleton instance = new Singleton();

    public static Singleton getInstance(){
        return instance;
    }
    private Singleton(){

    }
}
public class demo26 {
    public static void main(String[] args) {
        Singleton t1 = Singleton.getInstance();
        Singleton t2 = Singleton.getInstance();
        System.out.println(t1==t2);
        //Singleton t3 = new Singleton();//报错

    }
}
